package com.wswy.wzcx.ui.dialog

import android.content.Context
import android.os.Bundle
import android.support.annotation.DrawableRes
import android.support.v7.app.AppCompatDialog
import com.blankj.utilcode.util.SizeUtils
import com.makeramen.roundedimageview.RoundedImageView
import com.wswy.wzcx.R


class ImgDialog(context: Context,@DrawableRes val img :Int) : AppCompatDialog(context, R.style.customTransparentDialog2) {


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(RoundedImageView(context).apply {
            setCornerRadius(SizeUtils.dp2px(15f).toFloat())
            setImageResource(img)
        })

        // https://stackoverflow.com/questions/2459916/how-to-make-an-imageview-with-rounded-corners

//        setContentView(AppCompatImageView(context).apply {
//            setImageResource(img)
//
//
//            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//                setBackgroundResource(R.drawable.round_outline)
//                clipToOutline = true
//                outlineProvider = ViewOutlineProvider.BACKGROUND
//            }
//
//        })

    }

}